#include "circlular_queue.h"
#include <stdio.h>

#define LEN ((int)(sizeof(story) / sizeof(char *)))

static char *story[] = {
    "从前有座山,",
    "山里有座庙,",
    "庙里有个老和尚在给小和尚讲故事,",
    "讲的什么故事呢？",
};

int main() {
  cqueue q = queue_create();

  for (int i = 0; i < 4; i++) {
    queue_append(q, story[i % LEN]);
    printf("queue last: %s\n", queue_last(q));
  }

  while (!queue_is_empty(q))
    printf("queue remove head: %s\n", (char *)queue_remove_head(q));

  for (int i = 0; i < 4; i++) {
    queue_append(q, story[i % LEN]);
    printf("queue head: %s queue last: %s\n", (char *)queue_head(q),
           queue_last(q));
  }

  queue_destory(q);

  return 0;
}